package com.lc202309;

/**
 * Description:
 *
 * @Create 2023/9/4 22:29
 * @Version 1.0
 */
public class Solution1281 {
    public int subtractProductAndSum(int n) {
        int num1 = 1;
        int num2 = 0;
        String str = String.valueOf(n);
        int tmp = 0;
        for (int i = 0; i < str.length(); i++) {
            tmp = Integer.parseInt(String.valueOf(str.charAt(i)));
            num1 *= tmp;
            num2 += tmp;
        }
        return num1 - num2;
    }
}
